import {defaultStyle} from "@/svgutil/default-style";
import * as Dt from '@/svgutil/draw-type';

export const defineData1 = function (values, scale) {
    let tx = 100.5;
    let ty = 100.5;

    if(!scale){
        scale = {
            offsetX: 0,
            offsetY: 0,
            scale: 1,
        }
    }
    let offsetX = tx - scale.offsetX;
    let offsetY = ty - scale.offsetY;
    let draw = {
        //整理旋转角度： 90°。默认0
        //rotate: 90,
        //整体偏移大小： x:100,y:100；默认[0,0]
        translate: [scale.offsetX,scale.offsetY],
        //整体缩放
        scale: scale.scale,
        style: {...defaultStyle},
        children: [
            testRect4(offsetX,offsetY),
        ]
    };

    return draw;
}

function testRect4(offsetX,offsetY) {
    let rect = Dt.rect();
    let x = 100;
    let y = 100;
    let w = 100;
    let h = 100;
    x += offsetX;
    y += offsetY;
    //let tx = (405.5 - s.lastOffsetX) * s.lastScale - s.offsetX;
    //let ty = (105.5 -s.lastOffsetY) * s.lastScale - s.offsetY;
    rect.setStart([x, y])
        //.setTranslate(100, 100)
        .setStyle({fill: 'red'})
        //.setScale(s.scale)
        .setEnd([x + w, y + h]);
    return rect;
}
